package com.palm.hubo2o.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.palm.hubo2o.R;


/**
 * Created by dest1 on 2015/12/4.
 */
public class HelpAdapter extends RecyclerView.Adapter<HelpAdapter.HelpHolder> {
    private LayoutInflater mInflater;
    private String[] mTitles;
    private Context mContext;

    public HelpAdapter(Context context) {
        super();
        mContext = context;
        mTitles = mContext.getResources().getStringArray(R.array.help_items);
    }

    @Override
    public HelpHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (mInflater == null)
            mInflater = LayoutInflater.from(mContext);
        View v = mInflater.inflate(android.R.layout.simple_dropdown_item_1line, parent, false);
        return new HelpHolder(v);
    }

    @Override
    public void onBindViewHolder(HelpHolder holder, int position) {
        TextView title = (TextView) holder.itemView;
        title.setText(mTitles[position]);
    }

    @Override
    public int getItemCount() {
        return mTitles.length;
    }

    public class HelpHolder extends RecyclerView.ViewHolder {

        public HelpHolder(View itemView) {
            super(itemView);
        }
    }
}
